﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CreatMap : MonoBehaviour
{
    public static int m_heigth = 10;
    public static int m_width = 10;
    public static GameObject[,] MapItems;
	// Use this for initialization
	void Start () {
        MapItems = new GameObject[m_width, m_heigth];
        GameObject temp = Resources.Load("MapItem") as GameObject;
	    GameObject item = null;
	    for (int i = 0; i < m_heigth; i++)
	    {
	        for (int j = 0; j < m_width; j++)
	        {
	            item = Instantiate(temp);
	            item.transform.position = Vector3.right*j*1.2f + Vector3.up*i*1.2f;
                item.transform.SetParent(transform);
	            MapItems[j, i] = item;
	            item.GetComponent<MapItem>().X = j;
                item.GetComponent<MapItem>().Y = i;
            }
	    }
	}

}
